import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Scanner;


public class Test03 {
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		System.out.println("Input name: ");
		String name = scanner.nextLine();
		try{
			Connection conn = JDBCUtil.getConnection();
			String sql = "select * from Sample where Name=?";
			PreparedStatement ps = conn.prepareStatement(sql);
			ps.setString(1, name);
			ResultSet rs = ps.executeQuery();
			while(rs.next()){
				System.out.println(rs.getString("Name")+"\t"+rs.getInt("Age"));
			}rs.close();
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}
